home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / pluginy Firefox / 1843 / 1843.xpi / content / firebug / plugin.js < prev    next >
Text File  |  2010-01-15  |  3KB  |  130 lines

  1. /* See license.txt for terms of usage */
  2.  
  3. FBL.ns(function() { with (FBL) {
  4.  
  5. // ************************************************************************************************
  6.  
  7. Firebug.PluginPanel = function() {};
  8.  
  9. Firebug.PluginPanel.prototype = extend(Firebug.Panel,
  10. {
  11.     createBrowser: function()
  12.     {
  13.         var doc = Firebug.chrome.window.document;
  14.         this.browser = doc.createElement("browser");
  15.         this.browser.addEventListener("DOMContentLoaded", this.browserReady, false);
  16.         this.browser.className = "pluginBrowser";
  17.         this.browser.setAttribute("src", this.url);  // see tabContext.createPanelType
  18.     },
  19.  
  20.     destroyBrowser: function()
  21.     {
  22.         if (this.browser)
  23.         {
  24.             this.browser.parentNode.removeChild(this.browser);
  25.             delete this.browser;
  26.         }
  27.     },
  28.  
  29.     browserReady: function()
  30.     {
  31.         this.browser.removeEventListener("DOMContentLoaded", this.browserReady, false);
  32.         this.innerPanel = this.browser.contentWindow.FirebugPanel; // XXXjjb ?
  33.         if (this.visible)
  34.         {
  35.             if (this.innerPanel)
  36.                 innerCall(this.innerPanel, "initialize", [this.context.window]);
  37.             this.updateSelection(this.selection);
  38.         }
  39.     },
  40.  
  41.     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  42.     // extends Panel
  43.  
  44.     initialize: function()
  45.     {
  46.         this.browserReady = bindFixed(this.browserReady, this);
  47.         Firebug.Panel.initialize.apply(this, arguments);
  48.     },
  49.  
  50.     destroy: function(state)
  51.     {
  52.         this.destroyBrowser();
  53.         Firebug.Panel.destroy.apply(this, arguments);
  54.     },
  55.  
  56.     reattach: function(doc)
  57.     {
  58.         this.destroyBrowser();
  59.         this.createBrowser();
  60.     },
  61.  
  62.     show: function(state)
  63.     {
  64.         if (!this.browser)
  65.             this.createBrowser();
  66.     },
  67.  
  68.     hide: function()
  69.     {
  70.     },
  71.  
  72.     supportsObject: function(object)
  73.     {
  74.         if (this.innerPanel)
  75.             return innerCall(this.innerPanel, "supportsObject", [object]);
  76.         else
  77.             return 0;
  78.     },
  79.  
  80.     updateSelection: function(object)
  81.     {
  82.         if (!this.innerPanel)
  83.             return;
  84.  
  85.         innerCall(this.innerPanel, "select", [object]);
  86.     },
  87.  
  88.     getObjectPath: function(object)
  89.     {
  90.     },
  91.  
  92.     getDefaultSelection: function()
  93.     {
  94.     },
  95.  
  96.     updateOption: function(name, value)
  97.     {
  98.     },
  99.  
  100.     getOptionsMenuItems: function()
  101.     {
  102.     },
  103.  
  104.     getContextMenuItems: function(object, target)
  105.     {
  106.     },
  107.  
  108.     getEditor: function(target, value)
  109.     {
  110.     }
  111. });
  112.  
  113. // ************************************************************************************************
  114.  
  115. function innerCall(innerPanel, name, args)
  116. {
  117.     try
  118.     {
  119.         innerPanel[name].apply(innerPanel, args);
  120.     }
  121.     catch (exc)
  122.     {
  123.         ERROR(exc);
  124.     }
  125. }
  126.  
  127. // ************************************************************************************************
  128.  
  129. }});
  130.